//
//  STYHomeCell.m
//  CarOfHome2
//
//  Created by dlios on 15/9/24.
//  Copyright (c) 2015年 Frank. All rights reserved.
//

#import "STYHomeCell.h"
#import "HomeModel.h"

@interface STYHomeCell ()

@property (weak, nonatomic) IBOutlet UIImageView *photoImage;

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@property (weak, nonatomic) IBOutlet UILabel *timeLabel;

@property (weak, nonatomic) IBOutlet UIImageView *viewImage;

@property (weak, nonatomic) IBOutlet UILabel *viewLabel;

@property (weak, nonatomic) IBOutlet UILabel *typeLabel;


@end

@implementation STYHomeCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setModel:(HomeModel *)model
{
    if (_model != model) {
        _model = model;
    }
    AppDelegate *dele = [[UIApplication sharedApplication]delegate];
    if (dele.isNight == 1) {
        self.contentView.backgroundColor = [UIColor blackColor];
        self.titleLabel.textColor = [UIColor whiteColor];
        self.typeLabel.textColor = [UIColor whiteColor];
        self.viewLabel.textColor = [UIColor whiteColor];
    }
    else{
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.titleLabel.textColor = [UIColor blackColor];
        self.typeLabel.textColor = [UIColor blackColor];
        self.viewLabel.textColor = [UIColor blackColor];
            }

    [self.photoImage sd_setImageWithURL:[NSURL URLWithString:model.newsImage] placeholderImage:[UIImage imageNamed:@""]];
    
    self.titleLabel.text = model.newsTitle ;
    
    self.timeLabel.text = model.pubTime;
    
    self.typeLabel.text = model.newsCategory;
    
    self.viewLabel.text = [NSString stringWithFormat:@"%ld",model.commentCount];
    
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
